package xby.study.annotations.repeatable;

import java.lang.annotation.Annotation;
import java.util.Arrays;

@Result
@Result(name = "哈哈", age = 188)
@Result(name = "黑恶", age = 1)
public class Test {
    public static void main(String[] args) {

        Annotation[] re = Test.class.getAnnotations();
        for (Annotation a:re) {
            System.out.println(a);

        }
        System.out.println("------------1");
        Results r = Test.class.getAnnotation(Results.class);
        System.out.println(r);


        System.out.println("------------2");
        /*
          看到的比不一定是真实的！  因为重复注解
         */
        Result r1 = Test.class.getAnnotation(Result.class);
        System.out.println(r1);



        System.out.println("------------3");
        Result[] rs = Test.class.getAnnotationsByType(Result.class);

        System.out.println(Arrays.toString(rs));

        System.out.println("------------4");

        Annotation [] rs2 = Result.class.getAnnotations();

        for (Annotation a:rs2) {
            System.out.println(a);

        }

    }
}


